# eric7.EricWidgets.EricTabWidget

Module implementing a TabWidget class substituting QTabWidget.

### Global Attributes

None

### Classes

EricDnDTabBar | Class implementing a tab bar class substituting QTabBar.
EricTabWidget | Class implementing a tab widget class substituting QTabWidget.
EricWheelTabBar | Class implementing a tab bar class substituting QTabBar to support wheel events.

### Functions

None

## EricDnDTabBar

Class implementing a tab bar class substituting QTabBar.

### Signals

tabMoveRequested(int, int)
  emitted to signal a tab move request giving the old and new index position

### Derived from

EricWheelTabBar

### Class Attributes

None

### Class Methods

None

### Methods

EricDnDTabBar | Constructor
dragEnterEvent | Protected method to handle drag enter events.
dropEvent | Protected method to handle drop events.
mouseMoveEvent | Protected method to handle mouse move events.
mousePressEvent | Protected method to handle mouse press events.

### Static Methods

None

#### EricDnDTabBar (Constructor)

EricDnDTabBar(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### EricDnDTabBar.dragEnterEvent

dragEnterEvent(event)

Protected method to handle drag enter events.

event (QDragEnterEvent)
  reference to the drag enter event

#### EricDnDTabBar.dropEvent

dropEvent(event)

Protected method to handle drop events.

event (QDropEvent)
  reference to the drop event

#### EricDnDTabBar.mouseMoveEvent

mouseMoveEvent(event)

Protected method to handle mouse move events.

event (QMouseEvent)
  reference to the mouse move event

#### EricDnDTabBar.mousePressEvent

mousePressEvent(event)

Protected method to handle mouse press events.

event (QMouseEvent)
  reference to the mouse press event

Up

## EricTabWidget

Class implementing a tab widget class substituting QTabWidget.

It provides slots to show the previous and next tab and give them the input focus and it allows to have a context menu for the tabs.

### Signals

customTabContextMenuRequested(const QPoint & point, int index)
  emitted when a context menu for a tab is requested

### Derived from

QTabWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricTabWidget | Constructor
__currentChanged | Private slot to handle the currentChanged signal.
__freeSide | Private method to determine the free side of a tab.
__handleTabCustomContextMenuRequested | Private slot to handle the context menu request for the tabbar.
animationLabel | Public slot to set an animated icon.
moveTab | Public method to move a tab to a new index.
nextTab | Public slot used to show the next tab.
prevTab | Public slot used to show the previous tab.
resetAnimation | Public slot to reset an animated icon.
selectTab | Public method to get the index of a tab given a position.
setCustomTabBar | Public method to set a custom tab bar.
setTabContextMenuPolicy | Public method to set the context menu policy of the tab.
switchTab | Public slot used to switch between the current and the previous current tab.

### Static Methods

None

#### EricTabWidget (Constructor)

EricTabWidget(parent=None, dnd=False)

Constructor

parent (QWidget)
  reference to the parent widget
dnd (bool)
  flag indicating the support for Drag & Drop

#### EricTabWidget.__currentChanged

__currentChanged(index)

Private slot to handle the currentChanged signal.

index (int)
  index of the current tab

#### EricTabWidget.__freeSide

__freeSide()

Private method to determine the free side of a tab.

Return:
  free side

Return Type:
  QTabBar.ButtonPosition

#### EricTabWidget.__handleTabCustomContextMenuRequested

__handleTabCustomContextMenuRequested(point)

Private slot to handle the context menu request for the tabbar.

point (QPoint)
  point the context menu was requested

#### EricTabWidget.animationLabel

animationLabel(index, animationFile, interval=100)

Public slot to set an animated icon.

index (int)
  tab index
animationFile (str)
  name of the file containing the animation
interval (int)
  interval in milliseconds between animation frames

Return:
  reference to the created label

Return Type:
  EricAnimatedLabel

#### EricTabWidget.moveTab

moveTab(curIndex, newIndex)

Public method to move a tab to a new index.

curIndex (int)
  index of tab to be moved
newIndex (int)
  index the tab should be moved to

#### EricTabWidget.nextTab

nextTab()

Public slot used to show the next tab.

#### EricTabWidget.prevTab

prevTab()

Public slot used to show the previous tab.

#### EricTabWidget.resetAnimation

resetAnimation(index)

Public slot to reset an animated icon.

index (int)
  tab index

#### EricTabWidget.selectTab

selectTab(pos)

Public method to get the index of a tab given a position.

pos (QPoint)
  position determining the tab index

Return:
  index of the tab

Return Type:
  int

#### EricTabWidget.setCustomTabBar

setCustomTabBar(dnd, tabBar)

Public method to set a custom tab bar.

dnd (bool)
  flag indicating the support for Drag & Drop
tabBar (QTabBar)
  reference to the tab bar to set

#### EricTabWidget.setTabContextMenuPolicy

setTabContextMenuPolicy(policy)

Public method to set the context menu policy of the tab.

policy (Qt.ContextMenuPolicy)
  context menu policy to set

#### EricTabWidget.switchTab

switchTab()

Public slot used to switch between the current and the previous current tab.

Up

## EricWheelTabBar

Class implementing a tab bar class substituting QTabBar to support wheel events.

### Derived from

QTabBar

### Class Attributes

None

### Class Methods

None

### Methods

EricWheelTabBar | Constructor
wheelEvent | Protected slot to support wheel events.

### Static Methods

None

#### EricWheelTabBar (Constructor)

EricWheelTabBar(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### EricWheelTabBar.wheelEvent

wheelEvent(event)

Protected slot to support wheel events.

event (QWheelEvent)
  reference to the wheel event

Up